package com.sky.controller.user;

import com.sky.dto.CategoryPageQueryDTO;
import com.sky.entity.Category;
import com.sky.result.PageResult;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import com.sky.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController("UserCategoryController")
@RequestMapping("/user/category")
@Api(tags = "c端分类接口")
@Slf4j
public class CategoryController {
    @Autowired
    private UserService userService;

    @Autowired
    private CategoryService categoryService;
    /**
     * 分类查询
     * @return
     */
    @GetMapping("/list")
    @ApiOperation("分类查询")
    public Result<List<Category>> getTypeList(@RequestParam(required = false) Integer type){
        log.info("分类查询：{}", type);
        List<Category> categoryList=null;
        categoryList = categoryService.list(type);
        return Result.success(categoryList);
    }


}
